package com.atguigu.system.service.impl;

import com.atguigu.model.system.SysLoginLog;
import com.atguigu.system.mapper.SysLoginLogMapper;
import com.atguigu.system.service.AsyncLoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AsyncLoginLogServiceImpl implements AsyncLoginLogService {

    @Autowired
    private SysLoginLogMapper loginLogMapper;

    @Override
    public void recordLoginLog(String username, Integer status, String ipaddr, String message) {
        SysLoginLog sysLoginLog = new SysLoginLog();
        //用户名
        sysLoginLog.setUsername(username);
        //ip地址
        sysLoginLog.setIpaddr(ipaddr);
        //登录信息
        sysLoginLog.setMsg(message);
        //日志状态
        sysLoginLog.setStatus(status);
        //插入日志数据
        loginLogMapper.insert(sysLoginLog);
    }
}
